package com.yan.arraylist;

import java.util.ArrayList;

public class Test2 {
    public static void main(String[] args) {
        ArrayList<Student> stu = new ArrayList<>();
        stu.add(new Student("it001" , "黄渤" ,1.72));
        stu.add(new Student("it002" , "孙红雷" ,1.78));
        stu.add(new Student("it003" , "章子怡" ,1.64));
        stu.add(new Student("it004" , "杨颖" ,1.68));
        for (Student student : stu) {
            System.out.println(student);
        }
        System.out.println("stu.size() = " + stu.size());
        Student student = stu.get(2);
        System.out.println(student);
        System.out.println("-----------------");
        stu.remove(3);
        System.out.println("stu.size() = " + stu.size());
        System.out.println("--------------------------");
        stu.set(0 , new Student("it005" , "撒贝宁" , 1.67));
        for (Student student1 : stu) {
            System.out.println(student1);
        }
        System.out.println("-----------------------");
        for (Student stu1 : stu) {
            if(stu1.getHigh() >= 1.70){
                System.out.println(stu1);
            }
        }
        System.out.println("-----------------------");
        for (Student stu2 : stu) {
            if(stu2.getName().startsWith("孙")){
                System.out.println(stu2);
            }
        }

    }
}
